from django.db import models

# Create your models here.
from competition.models import CompetitionSeason
from school.models import School
import django.utils.timezone as timezone

class Group(models.Model):
    num = models.CharField(max_length=125, verbose_name='分组人数', help_text='分组人数',db_index=True)
    school = models.ForeignKey(School,on_delete=models.CASCADE,verbose_name='所属校区',help_text='所属校区',db_index=True)
    competition_season = models.ForeignKey(CompetitionSeason,verbose_name='所属赛季',help_text='所属赛季',on_delete=models.CASCADE)
    create_time = models.DateTimeField(verbose_name='创建日期',help_text='创建日期',default=timezone.now)



    class Meta:
        verbose_name = "分组"
        verbose_name_plural = verbose_name
        ordering = ['-id']

    def __str__(self):
        return "{}的分组".format(self.competition_season.competition_name)